import React,{useState,useCallback} from 'react'
import HookChild from './HookChild'
export default function HookParent() {
 console.log('父组件...');
 const [count,setCount]=useState(0)
 const sayHello=()=>{
    console.log('Helloworld....');
 }
 const sayHelloCb=useCallback(sayHello,[])
  return (
    <div>
        <h1>父组件</h1>
        <p>计数器:{count}</p>
        <button onClick={()=>setCount(count+1)}>+</button>
        <HookChild sayHi={sayHelloCb}></HookChild>
    </div>
  )
}
